<?php
/**
 * 联盟数据表
 */
namespace app\common\model;

use think\Model;
use think\Db;
use think\model\concern\SoftDelete;

class RoomModel extends Model
{
	use SoftDelete;
    protected $name = 'user_room';
    protected $deleteTime = 'delete_time';

    /**
     * 关联用户表
     *
     * @return [type] [description]
     */
    public function user()
    {
        return $this->hasOne('user_model', 'uid', 'uid');
    }

    /**
     * 关联桌子
     *
     * @return [type] [description]
     */
    public function table()
    {
        return $this->hasMany('table_model', 'rid', 'id');
    }

    public function param_format($param = array())
    {
        $param['limit'] = empty($param['limit']) ? 10 : $param['limit'];
        $param['page']  = empty($param['page']) ? 1 : $param['page'];
        $param['rid']  = empty($param['rid']) ? '' : $param['rid'];
        $param['status'] = !isset($param['status']) ? -1 : $param['status'];
        return $param;
    }
}
